package com.adapter.demo03;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * 适配器角色:
 * 将 Enumeration接口适配成 Iterator接口
 */
public class Enuterator implements Iterator {
    private Enumeration enumeration;
    public Enuterator(Enumeration enumeration){
        this.enumeration = enumeration;
    }
    @Override
    public boolean hasNext() {
        return enumeration.hasMoreElements();
    }

    @Override
    public Object next() {
        return enumeration.nextElement();
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
}
